<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.researchsubject.domain.*" pageEncoding="UTF-8"%>
<%@page import="com.hs.core.page.PageUtil,com.hs.core.utils.*"%>
<%@page import="cn.ac.cintcm.dataconverge.util.Constants;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String imagePath = path + "/index/";
List subjectList = (List)request.getAttribute("subjectList");  
String achId = (String)request.getAttribute("achId"); 
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title><%=Constants.APP_TITLE %>--成果课题关联信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=path%>/index/Themes/com/style.css" rel="stylesheet" type="text/css" /> 
    <script src="<%=path%>/index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
     <script src="<%=path%>/js/common.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
    <script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/subject.js'></script> 
    <script type="text/javascript">
    function addCup(){
         var achId = '<%=achId%>';
         var resultType = dwr.util.getValue("resultType");
         var resultLevel = dwr.util.getValue("resultLevel");
         var resultGrade = dwr.util.getValue("resultGrade");
         var belongyear = dwr.util.getValue("belongyear");
         if(isNull(resultType)){
           alert("请选择获奖类型");
           document.getElementById("resultType").focus();
           return;
         }
         if(isNull(resultLevel)){
           alert("请选择获奖等级");
           document.getElementById("resultLevel").focus();
           return;
         }
         if(isNull(resultGrade)){
           alert("请选择获奖级别");
           document.getElementById("resultGrade").focus();
           return;
         }
         if(isNull(belongyear)){
           alert("请选择获奖年份");
           document.getElementById("belongyear").focus();
           return;
         }
         subject.addCup(achId,resultType,resultLevel,resultGrade,belongyear,addCallBack);
     
    }
    function addCallBack(message){
       alert(message);
       document.location.replace(document.location.href);
    }
    function delSubject(id){
       if(confirm("确认要删除该成果关联的课题信息吗？")){
          subject.delSubject(id,<%=achId%>,delCallBack);
       }
    
    }
    function delCallBack(message){
       alert("删除成功");
       document.location.replace(document.location.href);
    }
    
    </script>
  </head>
  
  <body class="rtm_body" scroll=yes>
  <form name="form1">
    <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <span>
                <img src="<%=imagePath%>Themes/com/idt_tb_pass.gif" />&nbsp;&nbsp;已关联课题信息</span>
        </div>
    </div> 
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
            <td>
                <div class="content">
                    <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                        <tr>
                             
                            <td class="dg_headerstyle" align="center"  width="5%">
                                 序号</td>
                            <td class="dg_headerstyle">
                                 课题名称</td>
                            <td class="dg_headerstyle">
                                开始日期</td>
                            <td class="dg_headerstyle">
                                结束日期</td>
                                 <td class="dg_headerstyle">
                                查看</td> 
                                <td class="dg_headerstyle">
                                删除</td> 
                        </tr>
                        <%
                          
                          if(null != subjectList && subjectList.size()> 0){
                        	  for(int i = 0;i<subjectList.size();i++){
                        		   Map m = (Map)subjectList.get(i);
                          
                        %>
                        <tr class="dg_alternatingitemstyle">
                             
                            <td align="center" width="5%">
                                <%=i+1%></td>
                            <td align="center">
                                  <%=StringUtilTool.NULL2Blank(m.get("SUBJECTNAME")+"") %>
                            </td>
                            <td>
                                 <%=Tools.getDateStringByDate1((Date)m.get("STARTDATE")) %>
                            </td>
                            <td>
                                 <%=Tools.getDateStringByDate1((Date)m.get("ENDDATE")) %>
                            </td>
                            <td>
                               <img src="<%=path %>/index/Themes/com/zoom_16x16.gif" alt="查看" onclick="openwindow('<%=path %>/subjectToAdd.htm?action=viewSubject&id=<%=m.get("SUBJECTID") %>','','','')"  style="cursor:hand" /> 
                            </td>  
                            <td align="center">
                                <img src="<%=imagePath %>Themes/com/68design.net_registration1_(delete)_16x16.gif" onclick="javascript:delSubject('<%=m.get("SUBJECTID") %>');"
                                    alt="删除" />
                            </td> 
                        </tr> 
                        <%}}else{ %>
                         <tr class="dg_alternatingitemstyle"> 
                            <td colspan="6" align="center">
                                <font color=red>没有找到记录</font>
                            </td>  
                        </tr>  
                        <%} %>
                    </table>  
                </div>
            </td>
        </tr>
    </table>
    
    <table cellpadding="0" cellspacing="0" width="100%" height="100%" id="Table8">  
        <tr>
            <td valign="top" height="100%">
                <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                    <tr>
                        <td valign="top" >
                            <!------------------ 标题栏 ------------------>
                            <!--- 标题 ---->
                            <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                <tr >
                                    <td class="idt_tle_i">
                                        <img id="imgForm6" src="<%=basePath%>index/Themes/com/idt_tle_o.gif"></td>
                                    <td class="idt_tle_f1">
                                        添加关联课题</td>
                                </tr>
                            </table>
                            <!--- 内容 --->
                            <div id="tdForm">
                                <table border="0" cellpadding="0" cellspacing="1" width="100%" class="idt_fim_mg">
                                    <tr>
                                        <td class="fim_l" >
                                        <iframe id="iFrame1" name="iFrame1" width="100%" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="<%=path %>/subject.htm?action=listSearchSubject&achId=<%=achId %>"></iframe>
                                         </td>
                                          </tr>
                                </table>
                                <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
                                    <tr>
                                        <td align="right">
                                             
                                 <input type="button" value="关闭"   class="com_btn2"   onclick="window.close();" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                </table>
      </form>
</body>
</html>
